import os

funFlag = 1  # 1表示添加标志，2表示删除标志
folderName = './renameDir/'

dirlist = os.listdir(folderName)

for name in dirlist:
    print(name)

    if funFlag == 1:
        newName = '[test]-' + name
    elif funFlag == 2:
        num = len('[test]-')
        newName = name[num:]

    print(newName)

    os.rename(folderName + name, folderName + newName)
